﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Libs.Content;

public partial class Controls_Home_News : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;

        NewsWeb _NewsWeb = new NewsWeb();
        List<NewsWeb> list;

        list = _NewsWeb.GetList(2, 0, 4);
        for (int i = 0; i < list.Count; i++)
        {
            _NewsWeb = list[i];
            if (_NewsWeb.SubLead.Length > 180) _NewsWeb.SubLead = _NewsWeb.SubLead.Substring(0, 180) + "...";
            list[i] = _NewsWeb;
        }
        rptList.DataSource = list;
        rptList.DataBind();
    }
}